<?php

//print_r ($_POST);

require_once "func.php";

if (!isset ($_POST ["f_1"]) || !isset ($_POST ["f_2"])){
		$_POST ["f_1"] = "";
		$_POST ["f_2"] = "";
	}

	$f1 = $_POST ["f_1"];
	$f2 = $_POST ["f_2"];
	
		
if (($f1 && $f2) == !false){
		
			switch ($_POST["sign"]){
			case "add";
			$sum = addf ($f1, $f2);
			echo $sum;
			break;
		
			case "sub";
			$sum = subf ($f1, $f2);
			echo $sum;
			break;
			
			case "mul";
			$sum = mulf ($f1, $f2);
			echo $sum;
			break;
			
			case "div";
			$sum = divf ($f1, $f2);
			echo $sum;
			break;
			
		}
}
else {$_POST['sign'] = false;
echo "enter da data!!!";}
		
		
?>



<!DOCTYPE html>

<html>

	<head>
		<title> Calculator </title>
	</head>

	<body>
		
		<form action = "calc_index.php" method = "post" name = "cform">
			
			<input type = "text" name = "f_1"/>
			<select name = "sign">
				<option value = "add"> + </option>
				<option value = "sub"> - </option>
				<option value = "mul"> * </option>
				<option value = "div"> / </option>
				
			</select>
			<input type = "text" name = "f_2"/>
			<input type = "submit" value = "count"/>
			
			
		</form>
		
	</body>
</html>